import Vue from "vue";
import VueRouter from "vue-router";

import Layout from "@/components/Layout.vue";
import Login from "@/views/login/index.vue";
import Order from "@/views/order";
import Complain from "@/views/complain";
import Rate from "@/views/rate";
import User from "@/views/user";

Vue.use(VueRouter);

const routes = [
  {
    path: "/login",
    name: "Login",
    component: Login,
  },
  {
    path: "/",
    name: "Layout",
    component: Layout,
    redirect: "/order",
  },
  {
    path: "/order",
    component: Layout,
    children: [
      {
        path: "/order/",
        component: Order,
      },
    ],
  },
  {
    path: "/complain",
    component: Layout,
    children: [
      {
        path: "/complain/",
        component: Complain,
      },
    ],
  },
  {
    path: "/rate",
    component: Layout,
    children: [
      {
        path: "/rate/",
        component: Rate,
      },
    ],
  },
  {
    path: "/user",
    component: Layout,
    children: [
      {
        path: "/user/",
        component: User,
      },
    ],
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
